package com.tonann.app.mapper;

import com.tonann.app.domain.AppSensor;
import com.tonann.app.domain.AppSensorDept;
import com.tonann.app.domain.AppSensorPlace;
import com.tonann.common.core.domain.entity.SysDictData;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 传感器管理Mapper接口
 *
 * @author tonann
 * @date 2022-10-17
 */
public interface AppSensorMapper
{
    /**
     * 查询传感器管理
     *
     * @param sensorId 传感器管理主键
     * @return 传感器管理
     */
    public AppSensor selectAppSensorBySensorId(Long sensorId);

    /**
     * 查询传感器管理列表
     *
     * @param appSensor 传感器管理
     * @return 传感器管理集合
     */
    public List<AppSensor> selectAppSensorList(AppSensor appSensor);


    public List<AppSensor> selectAppSensorAll(AppSensor appSensor);


    public List<AppSensor> selectAppSensorAllList(AppSensor appSensor);

    /**
     * 新增传感器管理
     *
     * @param appSensor 传感器管理
     * @return 结果
     */
    public int insertAppSensor(AppSensor appSensor);

    /**
     * 修改传感器管理
     *
     * @param appSensor 传感器管理
     * @return 结果
     */
    public int updateAppSensor(AppSensor appSensor);

    /**
     * 删除传感器管理
     *
     * @param sensorId 传感器管理主键
     * @return 结果
     */
    public int deleteAppSensorBySensorId(Long sensorId);

    /**
     * 批量删除传感器管理
     *
     * @param sensorIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteAppSensorBySensorIds(Long[] sensorIds);

    /**
     * 根据传感器ID的部门查询设备树信息
     *
     * @param sensorId 传感器ID
     * @return 选中部门列表
     */
    public List<Long> selectAppSensorDeptListBySensorId(@Param("sensorId") Long sensorId);

    public List<Long> selectAppSensorPlaceListBySensorId(@Param("sensorId") Long sensorId);


    void deleteAppSensorDeptBySensorId(Long sensorId);

    void insertAppSensorDept(@Param("sensorId") Long sensorId, @Param("deptId") Long deptId);

    void deleteAppSensorPlaceBySensorId(Long sensorId);

    void insertAppSensorPlace(@Param("sensorId") Long sensorId, @Param("placeId") Long placeId);


    List<AppSensor> selectAppSensorListByGatewayType(String type);

    void updateAppSensorList(List<AppSensor> list);

    List<AppSensor> selectAppSensorNameAll(AppSensor appSensor);

    List<AppSensor> checkAppSensorNameUnique(String sensorName);

    List<AppSensor> selectAppSensorBaseAll();

    List<AppSensor> selectAppSensorListByTopic(String mqttTopic);

    List<AppSensor> selectAppSensorAllListByDeviceIds(List<Long> deviceIds);

    List<AppSensorPlace> selectAppSensorPlaceIdListBySensorIds(List<Long> sensorIdList);

    List<AppSensorDept> selectAppSensorDeptIdListBySensorIds(List<Long> sensorIdList);
    List<SysDictData> selectAppSensorTypeDict(Long sensorId);

    List<AppSensor> selectAppSensorAllListByDeviceIdsForAPP(List<Long> deviceIds);

    List<AppSensor> selectAppSensorAllListByDeviceIdForApp(Long deviceId);

    List<AppSensor> selectAppSensorListByDeviceId(Long deviceId);

    List<AppSensor> selectAppSensorAllPureList(AppSensor appSensor);
}
